package world.liuru.poem.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(name = "PICTURE ")
@EntityListeners(AuditingEntityListener.class)
public class Picture {
    @Id
    @Column(name = "ID")
    @GeneratedValue(generator = "id")
    @GenericGenerator(name = "id",strategy = "org.hibernate.id.UUIDGenerator")
    private String id;

    @Column(name = "IMG_URL",columnDefinition = "varchar(500) not null comment '图片地址'")
    private String imgUrl;

    @Column(name = "IMG_SIZE",columnDefinition = "varchar(100) comment '图片大小'")
    private String imgSize;

    @Column(name = "IMG_NAME",columnDefinition = "varchar(300) comment '图片名称'")
    private String imgName;

    @Column(name = "CREATED_BY",columnDefinition = "varchar(255) comment '创建者'")
    @CreatedBy
    private String createBy;

    @Column(name = "CREATE_DATE",columnDefinition = "date comment '创建日期'")
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createDate;

}
